import axios from 'axios'

const instance = axios.create({
  timeout: 3000,
})
instance.defaults.headers['X-Nideshop-Token'] = localStorage.getItem('token');
// 请求拦截
instance.interceptors.request.use(config => {

  // config['X-Nideshop-Token'] = localStorage.getItem('token')
  // console.log(config)
  return config;
}, err => {
  return Promise.reject(err);
})

// 响应拦截
instance.interceptors.response.use(result => {
  return result.data;
}, err => {
  return Promise.reject(err);
})

export default instance;